//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Query Application Block
//===============================================================================

using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Unity;
using EntLibContrib.Query.Configuration.Unity;
using EntLibContrib.Query.Queries;

namespace EntLibContrib.Query.Configuration
{
	/// <summary>
	/// Configuration data defining WcfServiceQueryData.
	/// </summary>    
	[Assembler(typeof(WcfServiceQueryAssembler))]
	[ContainerPolicyCreator(typeof(WcfServiceQueryPolicyCreator))]
	public class WcfServiceQueryData : ServiceQueryData
	{
		#region Constants
		private const string endpointProperty = "endpoint";
		#endregion

		#region Properties
		/// <summary>
		/// Name of the end point to use.
		/// </summary>
		/// <value>The name of the end point.</value>
		[ConfigurationProperty(endpointProperty, IsRequired = true)]
		public string Endpoint
		{
			get { return (string)base[endpointProperty]; }
			set { base[endpointProperty] = value; }
		}
		#endregion

		#region Construction
		/// <summary>
		/// Initializes a new instance of the <see cref="WcfServiceQueryData"/> class.
		/// </summary>
		public WcfServiceQueryData ()
		{
		}

		/// <summary>
		/// Initialize a new instance of the <see cref="WcfServiceQueryData"/> class.
		/// </summary>
		/// <param name="name">The name of the <see cref="WcfServiceQueryData"/>.</param>
		/// <param name="customCommandName">Name of the custom command.</param>
		/// <param name="parameterSetName">Name of the parameter set.</param>
		/// <param name="address">The service address.</param>
		/// <param name="service">The service type name.</param>
		/// <param name="method">The service method.</param>
		/// <param name="endpoint">The service end point.</param>
		public WcfServiceQueryData(string name, string customCommandName, string parameterSetName, string address, string service, string method, string endpoint)
			: base(name, typeof(WcfServiceQuery), customCommandName, parameterSetName, address, service, method)
		{
			this.Endpoint = endpoint;
		}
		#endregion
	}
}